package com.huawei.spare.part.replace.ssh;

import net.schmizz.sshj.SSHClient;
import net.schmizz.sshj.transport.verification.PromiscuousVerifier;
import net.schmizz.sshj.xfer.FileSystemFile;

import java.io.IOException;

/** This example demonstrates downloading of a file over SCP from the SSH server. */
public class SCPDownload {

    public static void main(String[] args)
            throws IOException {
        final SSHClient ssh = new SSHClient();
        ssh.addHostKeyVerifier(new PromiscuousVerifier());
        ssh.connect("115.159.160.190");
        ssh.authPassword("root", "AsdQweCxz");
        try {
            ssh.newSCPFileTransfer().download("/home/p.txt", new FileSystemFile("c:/p.txt"));
        } finally {
            ssh.disconnect();
        }
    }

}
